<template>
    <div>
        <h1>子组件</h1>
        <h2>获取父数据{{msg}}</h2>
        <input v-model="msg1" />
        <button @click="send">send message</button>


        <hr />
        <button @click="addone">修改状态count</button>
    </div>
</template>
<script>
import { mapActions } from 'vuex'
export default {
    name: 'head1',
    data() {
        return {
            msg1: ''
        }
    },
    props: ['msg'],
    created() {
        // this.$store.state.count = this.$store.state.count + 1
        console.info('子组件' + this.$store.state.count)

    },
    methods: {
        send(){
            this.$emit('enlarge-text', {msg1: this.msg1})
        },
        // 把test模块的addone函数加入到 methods
        ...mapActions('test', ['addone'])
    },
}
</script>

